using System;
using System.ComponentModel.DataAnnotations;
using ThuySan.Bussiness;

namespace ThuySan.Models
{
    [Serializable]
    public partial class TagModel
    {

        #region Constructor

        public TagModel()
        {
        }

        public TagModel(Tag value)
        {
            TagId = value.TagId;
            Name = value.Name;
            PageUrl = value.PageUrl;
            IsTopMenu = value.IsTopMenu ?? false;
            IsLeftColumn = value.IsLeftColumn ?? false;
            IsRightColumn = value.IsRightColumn ?? false;
            Description = value.Description;
            Avatar = value.Avatar;
            Detail = value.Detail;
            IsStaticContent = value.IsStaticContent ?? false;
            IsFooter = value.IsFooter ?? false;
        }

        #endregion

        #region Fields

        private System.Int32 _TagId;

        private System.String _Name;

        private System.String _PageUrl;

        private System.Boolean _IsTopMenu;

        private System.Boolean _IsLeftColumn;

        private System.Boolean _IsRightColumn;

        private System.String _Description;

        private System.String _Avatar;

        private System.String _Detail;

        private System.Boolean _IsStaticContent;

        private System.Boolean _IsFooter;

        #endregion

        #region Properties

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.Int32 TagId
        {
            get
            {
                return _TagId;
            }
            set
            {
                _TagId = value;
            }
        }

        //[NotChanged]
        [Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.String PageUrl
        {
            get
            {
                return _PageUrl;
            }
            set
            {
                _PageUrl = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.Boolean IsTopMenu
        {
            get
            {
                return _IsTopMenu;
            }
            set
            {
                _IsTopMenu = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.Boolean IsLeftColumn
        {
            get
            {
                return _IsLeftColumn;
            }
            set
            {
                _IsLeftColumn = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.Boolean IsRightColumn
        {
            get
            {
                return _IsRightColumn;
            }
            set
            {
                _IsRightColumn = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        [StringLength(500, ErrorMessage = "Value must be under 500 characters")]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                _Description = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        [StringLength(500, ErrorMessage = "Value must be under 500 characters")]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.String Avatar
        {
            get
            {
                return _Avatar;
            }
            set
            {
                _Avatar = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        [StringLength(1073741823, ErrorMessage = "Value must be under 1073741823 characters")]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.String Detail
        {
            get
            {
                return _Detail;
            }
            set
            {
                _Detail = value;
            }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public System.Boolean IsStaticContent
        {
            get
            {
                return _IsStaticContent;
            }
            set
            {
                _IsStaticContent = value;
            }
        }

        public System.Boolean IsFooter
        {
            get
            {
                return _IsFooter;
            }
            set
            {
                _IsFooter = value;
            }
        }

        #endregion

        #region Operators

        public void Update(Tag value)
        {
            //value.TagId = TagId;
            value.Name = Name;
            value.PageUrl = PageUrl;
            value.IsTopMenu = IsTopMenu;
            value.IsLeftColumn = IsLeftColumn;
            value.IsRightColumn = IsRightColumn;
            value.Description = Description;
            //value.Avatar = Avatar;
            value.Detail = Detail;
            value.IsStaticContent = IsStaticContent;
            value.IsFooter = IsFooter;
        }

        public static implicit operator TagModel(Tag obj)
        {
            return new TagModel(obj);
        }

        public static implicit operator Tag(TagModel obj)
        {
            Tag value = new Tag();
            obj.Update(value);
            return value;
        }

        #endregion

    }
}
